package com.lnsf.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lnsf.dao.DepartmentDao;
import com.lnsf.entity.Department;
import com.lnsf.service.DeptService;



@Service
public class DeptServiceImpl implements DeptService{
	
	@Autowired
	private DepartmentDao departmentDao;

	@Override
	public List<Department> getAllDepartment() {
		
		List<Department> department = departmentDao.getAllDepartment();
		return department;
	}

	
	@Override
	public Department getDepartmentById(int deptno) {
		
		Department department = departmentDao.getDepartmentById(deptno);
		return department;
	}
	
	
	@Override
	public void addDepartment(Department dept) {
		try {
			
			departmentDao.addDepartment(dept);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}


	@Override
	public void updateDepartment(Department dept) {
		try {
			departmentDao.updateDepartment(dept);
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}


	@Override
	public void deleteDepartment(int deptno) {
		try {
			deleteDepartment(deptno);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
	
	
	
	public DepartmentDao getDepartmentDao() {
		return departmentDao;
	}

	public void setDepartmentDao(DepartmentDao DepartmentDao) {
		this.departmentDao = DepartmentDao;
	}


	



	
	
	
	
}
